//import io.prometheus.client.Collector;
//import io.prometheus.client.exporter.TextFormat;
//
//import java.io.ByteArrayInputStream;
//import java.io.IOException;
//import java.util.Collections;
//
//public class PrometheusTextParser {
//
//    public static void parsePrometheusText(String prometheusText) throws IOException {
//        TextFormat.parse(new ByteArrayInputStream(prometheusText.getBytes()), Collections.emptyList())
//                .forEach(metricFamilySamples -> {
//                    // 处理每个指标族（MetricFamilySamples）
//                    System.out.println("Metric name: " + metricFamilySamples.name());
//                    metricFamilySamples.samples().forEach(sample -> {
//                        // 处理每个样本（Sample）
//                        System.out.println("  Name: " + sample.name() + ", Labels: " + sample.labelNames() + ", Value: " + sample.value());
//                    });
//                });
//    }
//
//    public static void main(String[] args) throws IOException {
//        String prometheusData = "my_metric_name{label1=\"value1\",label2=\"value2\"} 123.456\nanother_metric 456";
//        parsePrometheusText(prometheusData);
//    }
//}